package com.zhangjianbing.hystrix.custom02.service.impl;

import com.zhangjianbing.hystrix.custom02.annotation.HystixCmdRpc;
import com.zhangjianbing.hystrix.custom02.callback.RpcFailCallback;
import com.zhangjianbing.hystrix.custom02.service.IUserService;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @author zhangjianbing
 * time 2021/2/20
 */
@Service
public class UserServiceImpl implements IUserService {

    @Override
    @HystixCmdRpc(callback = RpcFailCallback.class)
    public String getUserInfo(String url) {
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate.getForObject(url, String.class);
    }

}
